from langchain.chains import SimpleSequentialChain
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.chains import LLMChain
# llm = ChatOpenAI(temperature=0.9, model=llm_model)
llm = ChatOpenAI(
            model="deepseek-chat",
            api_key="sk-079f9ad2ad3f457ebd6e6eb90f56fb53",
            base_url="https://api.deepseek.com/v1",  # DeepSeek API 地址
            temperature=0.7
        )
# prompt template 1
first_prompt = ChatPromptTemplate.from_template(
    "What is the best name to describe \
    a company that makes {product}?"
)

# Chain 1
chain_one = LLMChain(llm=llm, prompt=first_prompt)
# prompt template 2
second_prompt = ChatPromptTemplate.from_template(
    "Write a 20 words description for the following \
    company:{company_name}"
)
# chain 2
chain_two = LLMChain(llm=llm, prompt=second_prompt)
overall_simple_chain = SimpleSequentialChain(chains=[chain_one, chain_two],
                                             verbose=True )
product = "Apple Phone"
print(overall_simple_chain.run(product))